main(n,i,p,a,x,b)
{
	for(gets(&n);~scanf("%d",&n);printf("%.2f\n",.000001+1.*(a-b-x)/(n-2)))
		for(a=x=i=0,b=10000;i++<n;){
			scanf("%d",&p);a+=p;b=b<p?b:p;x=x>p?x:p;
		};
}
